
#!/bin/bash

echo "🚀 启动DeepSeekOCR-ESG测试平台..."
echo "================================"

# 检查Python环境
if ! command -v python3 &> /dev/null; then
    echo "❌ Python3未安装，请先安装Python3.11+"
    exit 1
fi

# 检查依赖
echo "📦 检查Python依赖..."
cd backend
if [ ! -d "venv" ]; then
    echo "创建虚拟环境..."
    python3 -m venv venv
fi

source venv/bin/activate

# 安装依赖
echo "安装依赖包..."
pip install -r requirements.txt

# 启动服务
echo "🌐 启动FastAPI服务..."
echo "服务地址: http://localhost:8000"
echo "测试平台: http://localhost:8000/static/index.html"
echo "按Ctrl+C停止服务"
echo "================================"

# 创建必要的目录
mkdir -p ../data/{reports,annotations,results}
mkdir -p static

# 复制前端文件到static目录
cp -r ../frontend/* static/

# 启动服务
uvicorn main:app --host 0.0.0.0 --port 8000 --reload
